

class.hero_data = extends(class.button) {
    new = function (parent,x,y,w,h)
        local panel = class.hero_data:builder 
        {
            parent = parent,
            x = x,
            y = y,
            w = w,
            h = h,
        }
        return panel
    end,

    init = function (self)
        class.button.init(self)
        --self:add_frame('tooltip_backdrop1')
        --
        --self.title = self:add_text('英雄名称',0,20,nil,25,14,5)
        --self.tx = self:add_text('|cffff00ff隐藏|r',0,20,100,25,14,5)
        --self.actor = self:add_actor('潮汐猎人',50,50,self.w-100,self.h-150)
--
        ----展示技能
        --local count = 2
        --local w0,h0 = 64,64
        --local gap = 16
        --local x0 = (self.w - ((w0+gap)*count - gap))/2
        --self.skills = {}
        --for i=1,count do
        --    local sp = self:add_button('',x0 + (i-1)*(w0+gap),self.h - 100,w0,h0)
        --    sp.sp = true
        --    self.skills[i] = sp
        --end
        self:add_panel([[ui\英雄面板\底.tga]])
        local panel_n = self:add_panel([[ui\英雄面板\命名栏.tga]],0,self.h*0.5,nil,self.h*0.167)
        self.tx = self:add_text('|cffff00ff隐藏|r',self.w*0.05,self.h*0.5,100,50,14,5)
        self.title = class.text:builder
        {
            parent = panel_n,
            text = '潮汐猎人',
            font_size = 16,
            h = 50,
            align = 5,
            outline = true,
            shadow_color = 0xff000000,
            color = 0xffffcc99,

        }
        self.skills = {}
        self.skills[1] = self:add_button([[core\emptyinvslot.tga]],50,self.h*0.9 - 96,96,96)

        self.skills[2] = self:add_button([[core\emptyinvslot.tga]],170,self.h*0.9 - 64,64,64)
        self.skills[2]:add_panel([[ui\英雄面板\保留-常.tga]],(self.skills[2].w-70)/2,-40,70,40)

        self:add_panel([[ui\英雄面板\框.tga]])
        self.actor = self:add_actor('潮汐猎人',50,0,self.w-120,self.h*0.5)


        return self
    end,
    on_button_mouse_enter = function(self,button)
        local skill = button and button.skill
        if skill then
            local tip = skill:get_tip()
            self:tooltip(skill.title or skill.name,tip,'auto')
        end
    end,
    set_data = function(self,data)
        self.title:set_text(data.title or data.name)
        self.actor:set_actor(data.name)
        self.actor:set_size(data['UI大小'] or 1)
        if data['隐藏'] then
            self.tx:show()
        else
            self.tx:hide()
        end
        for a,button in ipairs(self.skills) do
            local name = ('技能%s'):format(a)
            local skill = data[name]
            button.skill = skill
            button:set_normal_image(skill.art)
        end
    end,
}